多个账号配置 ssh
生成公私钥
1
2ssh-keygen -t rsa -C "邮箱地址" -f ~/.ssh/work_id_rsa
ssh-keygen -t rsa -C "邮箱地址" -f ~/.ssh/github_id_rsa公钥(*.pub)copy到平台上
1
2cat ~/.ssh/work_id_rsa.pub
cat ~/.ssh/github_id_rsa.pub修改config文件
1
2
3
4
5
6
7
8Host work.domain.com
HostName work.domain.com
User git
IdentityFile ~/.ssh/work_id_rsa
Host github.com
HostName github.com
IdentityFile ~/.ssh/github_id_rsa
测试配置结果
1 | ssh -T git@github.com |